package GraphTheory;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Stack;


class Solver1022
{	int n;
	int[] nPr;
	List<List<Integer>> Rec;
	Stack<Integer> Rs;
	
	public void Input() throws IOException
	{	StreamTokenizer in=new StreamTokenizer(new InputStreamReader(System.in));
		int tmp;
		in.nextToken();n=(int)in.nval;
		
		nPr=new int[n+1];
		Rec=new ArrayList<List<Integer>>();
		Rs=new Stack<Integer>();
		
		for (int i=0;i<nPr.length;i++)
			nPr[i]=0;
		for (int i=0;i<=n;i++)
			Rec.add(new LinkedList<Integer>());
		for (int i=1;i<=n;i++)
		{	int count=0;
			do
			{	in.nextToken();tmp=(int)in.nval;
				if (tmp!=0)
				{	Rec.get(tmp).add(i);
					nPr[i]++;
					count++;
				}
			}
			while(tmp!=0);
		}
	}
	public void Solve()
	{	Queue<Integer> lst=new LinkedList<Integer>();
		for (int i=1;i<=n;i++)
			if (nPr[i]==0)
				lst.add(i);
		while (!lst.isEmpty())
		{	int i=lst.remove();
			Rs.push(i);
			for (Integer j:Rec.get(i))
			{	nPr[j]--;
				if (nPr[j]==0) lst.add(j);
			}
		}
	}		
	public void Output()
	{	while (!Rs.isEmpty())
			System.err.print(Rs.pop()+" ");
		System.out.println();
	}
	public void main() throws IOException
	{	Input();
		Solve();
		Output();
	}
}
public class P1022
{	public static void main(String[] args) throws IOException
	{	Solver1022 solver=new Solver1022();
		solver.main();
	}
}
